package com.jic.order.controller.manage;

import com.jic.common.base.vo.RestResult;
import com.jic.order.entity.OrderBaleDelivery;
import com.jic.order.manage.request.OrderBaleDeliveryRequest;
import com.jic.order.rest.request.OrderBaleRestRequest;
import com.jic.order.rest.response.OrderBaleInfoResponse;
import com.jic.order.service.OrderBaleDeliveryService;
import com.jic.order.service.OrderBaleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by HeJun on 2020/2/29
 *
 * @Description:
 */
@Api(tags = "包裹物流")
@RestController
@RequestMapping("/orderBaleDelivery")
@Slf4j
public class OrderBaleDeliveryController {

    @Autowired
    OrderBaleDeliveryService orderBaleDeliveryService;
    @Autowired
    OrderBaleService orderBaleService;

    @ApiOperation(value = "获取包裹列表信息", notes = "获取包裹列表信息")
    @PostMapping("/query")
    public RestResult<List<OrderBaleDelivery>> query(@RequestBody OrderBaleDeliveryRequest obdr) {
        OrderBaleDelivery orderBaleDelivery = new OrderBaleDelivery();
        orderBaleDelivery.setBaleNo(obdr.getBaleNo());
        List<OrderBaleDelivery> result = orderBaleDeliveryService.query(orderBaleDelivery);
        return RestResult.success(result);
    }

    @ApiOperation(value = "根据订单编号查询包裹物流信息")
    @RequestMapping(value = "queryDeliveryByOrderNo", method = RequestMethod.POST)
    public RestResult<OrderBaleInfoResponse> queryDeliveryByOrderNo(@RequestBody OrderBaleRestRequest orderBaleRequest) {
        return RestResult.success(orderBaleService.getDeliveryByOrderNo(orderBaleRequest));
    }

}

